layui.define(['jquery','layer','form','element'], function (exports) {
     var $ = layui.jquery;
     var  layer = layui.layer;
     var form = layui.form();
     var element = layui.element();
     var edit_grade=function(){};

     edit_grade.prototype.init=function(){
         $.post("/srv/rdo.php?", {tpl:"getDct",name:"部门类型"}, function (d, e) {
           selectShowDataNoH("#depttype",JSON.parse(d),"id","name");
           $("#depttype").prepend("<option value=''>选择部门类型</option>");
           $("#depttype").val($("#stype").val());
           form.render('select');
        });
        $.post("/srv/rdo.php?", {tpl:"getSchool"}, function (d, e) {
           selectShowDataNoH("#mech",JSON.parse(d),"id","sch_name");
           $("#mech").prepend("<option value=''>选择机构</option>");
           $("#mech").val($("#smech").val());
           form.render('select');
        });        

        var index = parent.layer.getFrameIndex(window.name);
        $('#btn_save').click(function(){
            if($("#deptname").val()==""){layer.msg("部门名称不能为空");return false;}
            parent.layer.close(index);
        });
     }  
     var fg=$("#fg").val();
        if(fg==1){
            $(":radio[name='flag'][value='1']").prop("checked", "checked");
        }else{
            $(":radio[name='flag'][value='0']").prop("checked", "checked");
        }
        form.render('radio'); 
     
     var editSubject=new edit_grade();
     editSubject.init();

     exports('system_edit_dept', editSubject);
});